<?php $this->load->helper('HTML');
echo link_tag('css/style2.css');
echo link_tag('images/favicon.ico','shortcut icon','image/x-icon');
?>
<h2 class="title">Masukan Unit Baru</h2>
<form method="post" id="myForm" action="<?php echo $form_action?>">
    <table width="95%" border="0" cellpadding="0" cellspacing="0" id="data" align="left">
        <tr><td>&nbsp;<td></tr>
        <tr>
            <td colspan="5" align="left"><strong>Nama Unit Baru : </strong><input type="text" name="unit" id="unit" size="40">&nbsp;
                <input type="hidden" name="strkode_dealer"  id="strkode_dealer" value="<?php echo $strkode?>">
                <input type="submit" name="simpan" id="submit7" value="simpan"></td>
            <td colspan="2" align="center">&nbsp;</td>
        </tr>
    </table>
</form>
<p>&nbsp;</p>
<p>&nbsp;</p>
<?php echo form_error('unit', '<p class="field_error">', '</p>');?>
<div id="message7"></div>
<script type="text/javascript">

    $(document).ready( function() {
        $('#submit7').click(function() {
            var form_data = {
                strkode_dealer : $('#strkode_dealer').val(),
                unit : $('#unit').val(),
                bulan : $('#bulan').val(),
                tahun : $('#tahun').val(),
                ajax : '1'
            };
            $.ajax({
                url: "<?php echo base_url(); ?>calon_manager/simpan_manager",
                type: 'POST',
                async : false,
                data: form_data,
                beforeSend: function() {
				$('#message7').html('<tr><td colspan=2><?php echo "<img src=".base_url()."images/loading.gif align=absmiddle/>" ?> >> Loading .... Pembentukan Unit Baru</td></tr>');
			},
                success: function(msg) {
                    $('#message7').html(msg);
                    
                       // $('#unit').attr('disabled', 'disabled');
                    
                }
            });
            return false;

        });
    });

    $('#myForm').submit(function(event){
        if($("#unit").val()==""){
            alert('Unit tidak Boleh Kosong!');
            $("#unit").focus();
            event.preventDefault();
        }

    });
</script>